//
//  SpecialModel.m
//  B项目
//
//  Created by lanou on 15/12/17.
//  Copyright © 2015年 tzf. All rights reserved.
//

#import "SpecialModel.h"

@implementation SpecialModel

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"]) {
        self.ID = value;
    }
}



//@property (nonatomic, copy) NSString *banner_image_url;
//@property (nonatomic, copy) NSString *cover_image_url;
//@property (nonatomic, copy) NSString *created_at;
//@property (nonatomic, copy) NSString *ID;
//@property (nonatomic, copy) NSString *posts_count;
//@property (nonatomic, copy) NSString *status;
//@property (nonatomic, copy) NSString *subtitle;
//@property (nonatomic, copy) NSString *title;
//@property (nonatomic, copy) NSString *updated_at;
//@property (nonatomic, retain) UIImage *imageIcon;


- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_banner_image_url forKey:@"title"];
    [aCoder encodeObject:_cover_image_url forKey:@"begin_time"];
    [aCoder encodeObject:_created_at forKey:@"end_time"];
    [aCoder encodeObject:_ID forKey:@"address"];
    [aCoder encodeObject:_posts_count forKey:@"category_name"];
    [aCoder encodeObject:_status forKey:@"participant_count"];
    
    [aCoder encodeObject:_subtitle forKey:@"1"];
    [aCoder encodeObject:_title forKey:@"2"];
    [aCoder encodeObject:_updated_at forKey:@"3"];
    [aCoder encodeObject:_imageIcon forKey:@"4"];
    
    [aCoder encodeDataObject:UIImagePNGRepresentation(_imageIcon)];
}



- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        self.banner_image_url = [aDecoder decodeObjectForKey:@"title"];
        self.cover_image_url = [aDecoder decodeObjectForKey:@"begin_time"];
        self.created_at = [aDecoder decodeObjectForKey:@"end_time"];
        self.ID = [aDecoder decodeObjectForKey:@"address"];
        self.posts_count = [aDecoder decodeObjectForKey:@"category_name"];
        self.status = [aDecoder decodeObjectForKey:@"participant_count"];
        
        self.subtitle = [aDecoder decodeObjectForKey:@"1"];
        self.title = [aDecoder decodeObjectForKey:@"2"];
        self.updated_at = [aDecoder decodeObjectForKey:@"3"];
        self.imageIcon = [aDecoder decodeObjectForKey:@"4"];
        self.imageIcon= [UIImage imageWithData:[aDecoder decodeDataObject]];
    }
    return self;
}



















@end
